//实例化表格
layuiFunciton.tableInit({
    toolbar:'.btn',
    tableId: 'activitiModelTalbe',
    url:  layuiFunciton.URL + '/activiti/model/list',
    id: 'activitiModelTalbeId',
    tableFilter:'activitiModelFilter',  //表格监听名称,
    page:false,
    cols: [[
        {type:'numbers',title: '序号',fixed: 'left'},
        {field: 'key', title: '模型key', sort: true},
        {field: 'name', title: '模型名称', sort: true},
        {field: 'revision', title: '版本号', sort: true},
        {field: 'createTime', title: '创建时间', sort: true,templet:function (obj) {
            return layuiFunciton.formatDateTime(obj.createTime);
        }},
        {field:'lastUpdateTime', title: '修改时间', sort: true,templet:function (obj) {
            return layuiFunciton.formatDateTime(obj.lastUpdateTime);
        }},
        {title: '操作', align:"center",templet: '#activitiModelBar',fixed: 'right'}
    ]],
    tools:{
        zuihouyiye:function (rowData) {//部署
            layuiFunciton.ajaxRequest({
                url: layuiFunciton.URL + '/activiti/model/deploy/'+rowData.id,
                method:'get',
                success:function (data) {
                    layuiFunciton.success("部署完成！",function () {
                        layuiFunciton.addTab({
                            title:'流程实例',
                            url:'/page/core/activiti/example/index.html'
                        });
                    });
                }
            });
        }
        ,daochu:function (rowData) {//导出BPMN
            window.parent.location.href=layuiFunciton.URL + "/activiti/model/export/"+rowData.id+"/bpmn";
        },
        edit:function (rowData) {
            /*layuiFunciton.layerOpen({title:"修改模型",finder:"form",pageReady:false,content:layuiFunciton.URL + "/modeler.html?modelId="+rowData.id,end:function () {
             layuiFunciton.refresh('','activitiModelTalbeId');
             }});*/
            layuiFunciton.layerOpen({
                title: "修改",
                pageReady:false,
                content: layuiFunciton.URL + "/modeler.html?modelId=" + rowData.id
            });
        }
        ,del:function (rowData) {
            layuiFunciton.alert({types:'confirm',title:'是否删除？',success:function () {
                layuiFunciton.ajaxRequest({
                    url: layuiFunciton.URL + '/activiti/model/delete/'+rowData.id,
                    method:'post',
                    success:function (data) {
                        layuiFunciton.success("操作成功！",function () {
                            layuiFunciton.refresh('','activitiModelTalbeId');
                        });
                    }
                });
            }});
        },
		addActivitiModel:function(rowData){
			 layuiFunciton.layerOpen({title:"新增模型",finder:"form",content:"add.html",end:function () {
			    layuiFunciton.refresh('','activitiModelTalbeId');
			}});
		}
    }
});